package com.tingyuge.base.thread.wang.chapter2;

public class TicketWindow extends Thread {

    private final String name;
    private static Object object = new Object();
    private  static int index=1;
    private int max = 50;


    public TicketWindow(String name){
        this.name = name;
    }

    @Override
    public void run() {
        synchronized (object){
            while (index <=50){
                System.out.println(name +" 售出："+ (index++)+"票");
            }
        }

    }
}
